package cn.xuan.zp.web.ov;

import cn.xuan.zp.db.domain.Article;

public class ArticleVO {
    String title; // 标题
    String content; // 内容
    String type; // 类型
    String tag; // 标签
    String indexPicture; // 首图地址
    String recommend;
    String aritcleType; // 文章类型
    String shareInfo; // 转载声明
    String appreciation; // 赞赏声明
    String comment; // 评论

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }

    public String getIndexPicture() {
        return indexPicture;
    }

    public void setIndexPicture(String indexPicture) {
        this.indexPicture = indexPicture;
    }

    public String getRecommend() {
        return recommend;
    }

    public void setRecommend(String recommend) {
        this.recommend = recommend;
    }

    public String getAritcleType() {
        return aritcleType;
    }

    public void setAritcleType(String aritcleType) {
        this.aritcleType = aritcleType;
    }

    public String getShareInfo() {
        return shareInfo;
    }

    public void setShareInfo(String shareInfo) {
        this.shareInfo = shareInfo;
    }

    public String getAppreciation() {
        return appreciation;
    }

    public void setAppreciation(String appreciation) {
        this.appreciation = appreciation;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Article getArticle(){
        Article article = new Article();
//        String title; // 标题
        article.setTitle(title);
//        String content; // 内容
        article.setContent(content);
//        String type; // 类型
        article.setType(type);
//        String tag; // 标签
        article.setTag(tag);
//        String indexPicture; // 首图地址
        article.setTopImgUrl(indexPicture);
//        String recommend;
        if("on".equals(recommend)){
            article.setRecommend("1");
        }else{
            article.setRecommend("0");
        }
//        String aritcleType; // 文章类型
        article.setMode(aritcleType);
//        String shareInfo; // 转载声明
        if("on".equals(shareInfo)){
            article.setCopyInfo("1");
        }else{
            article.setCopyInfo("0");
        }
//        article.setCopyInfo(shareInfo);
//        String appreciation; // 赞赏声明
        if("on".equals(appreciation)){
            article.setAppreciation("0");
        }else{
            article.setAppreciation("1");
        }
//        String comment; // 评论
        if("on".equals(comment)){
            article.setComment("0");
        }else{
            article.setComment("1");
        }

        return article;
    }

    @Override
    public String toString() {
        return "ArticleVO{" +
                "title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", type='" + type + '\'' +
                ", tag='" + tag + '\'' +
                ", indexPicture='" + indexPicture + '\'' +
                ", recommend='" + recommend + '\'' +
                ", aritcleType='" + aritcleType + '\'' +
                ", shareInfo='" + shareInfo + '\'' +
                ", appreciation='" + appreciation + '\'' +
                ", comment='" + comment + '\'' +
                '}';
    }
}
